package com.soft.dao;

import com.soft.IBaseDao.IBaseDao;
import com.soft.pojo.Jianli;
import com.soft.utils.DBUtil;

import java.util.List;

/**
 * @author ruoxi
 * @create 2021-12-27 10:53
 */
public class EmpRecordDaoImpl implements IBaseDao<Jianli> {
    @Override
    public int add(Jianli var1) {
        return DBUtil.excute("insert into jianli values(?,?,?,?,?,?,?,?,?,?,'1')" ,
                null,var1.getName(),var1.getSex(),var1.getBirth(),var1.getMianmao(),var1.getCollage(),var1.getExpensive(),var1.getZhengshu(),var1.getJob(),var1.getdName());
    }

    @Override
    public int del(int var1) {
        return 0;
    }

    @Override
    public int update(Jianli var1) {
        return 0;
    }

    @Override
    public List<Jianli> selectByAll() {
        return DBUtil.query("select * from jianli", Jianli.class);
    }

    @Override
    public Jianli selectByKey(Jianli var1) {
        return null;
    }

    public List<Jianli> selectEmpRecordByPage(int currentPage,int currentCount) {
        return DBUtil.query("select * from jianli where state = 0 limit ?,?", Jianli.class,currentPage,currentCount);
    }

    public List<Jianli> selectEmpRecordCheckByPage(int currentPage,int currentCount) {
        return DBUtil.query("select * from jianli where state = 1 limit ?,?", Jianli.class,currentPage,currentCount);
    }

    public List<Jianli> selectEmpRecordById(int id){
        return DBUtil.query("select * from jianli where id = ?", Jianli.class, id);
    }

    public int resumeCheckFail(int id){
        return DBUtil.excute("update jianli set state = 2 where id = ?",id);
    }
}
